import { _decorator, Component, Label, Node } from 'cc';
import { ModuleBase } from '../Card/ModuleBase';
import { GameData } from '../GameData';
const { ccclass, property } = _decorator;

@ccclass('PlayNumAndDisNum')
export class PlayNumAndDisNum extends ModuleBase {
    private playnum:number=0;
    get _playnum(){
        return this.playnum;
    }
    private disnum:number=0;
    get _disnum(){
        return this.disnum;
    }
    private playnumL: Label = null;
    private disnumL: Label = null;
    onInit(...rest: any[]): void {
        this.playnum=GameData.playnum;
        this.disnum=GameData.disnum;
        this.playnumL=this.node.getChildByName("_Playnum").getComponent(Label);
        this.disnumL=this.node.getChildByName("Disnum").getComponent(Label);
        this.playnumL.string="出牌数:"+this.playnum;
        this.disnumL.string="弃牌数:"+this.disnum;
    }
    modfiyPlay(){
        this.playnum--;
        this.playnumL.string="出牌数:"+this.playnum;
        GameData.playCardnum=this.playnum;
    }
    modfiyDis(){
        this.disnum--;
        this.disnumL.string="弃牌数:"+this.disnum;
    }
}


